package de.tabuma.wsdl2xform.history.entity;

import java.text.ParseException;
import java.util.*;
import javax.jdo.annotations.*;

/**
 *
 * @author $Author: alefen $
 * @version $Revision: 1.1 $
 * @since $Date: 2009/07/21 19:37:14 $
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class JournalEntry {

    public static final int PARAMETER_STYLE_STRING = 1;
    public static final int PARAMETER_STYLE_DATE = 2;
    public static final int PARAMETER_STYLE_LIST = 3;
    public static final int PARAMETER_STYLE_LONG = 4;
    public static final int PARAMETER_STYLE_DOUBLE = 5;
    public static final int PARAMETER_STYLE_BOOLEAN = 6;

    private JournalEntry(int itemTyp, int itemId, String user, int action, int parameterId, int parameterStyle, String parameterString, Date parameterDate, List parameterList, Long parameterLong, Double parameterDouble, Boolean parameterBoolean) {
        this.itemTyp = itemTyp;
        this.itemId = itemId;
        this.user = user;
        this.date = GregorianCalendar.getInstance().getTime();
        this.action = action;
        this.parameterId = parameterId;
        this.parameterStyle = parameterStyle;
        this.parameterString = parameterString;
        this.parameterDate = parameterDate;
        this.parameterList = parameterList;
        this.parameterLong = parameterLong;
        this.parameterDouble = parameterDouble;
        this.parameterBoolean = parameterBoolean;
    }

    public JournalEntry(int itemTyp, int itemId, String user, int action,int parameterId,String parameterValue) {
        this(itemTyp, itemId, user, action, parameterId, PARAMETER_STYLE_STRING, parameterValue, null, null, null, null, null);
    }
    public JournalEntry(int itemTyp, int itemId, String user, int action,int parameterId,Date parameterValue) {
        this(itemTyp, itemId, user, action, parameterId, PARAMETER_STYLE_DATE, null, parameterValue, null, null, null, null);
    }
    public JournalEntry(int itemTyp, int itemId, String user, int action,int parameterId,List parameterValue) {
        this(itemTyp, itemId, user, action, parameterId, PARAMETER_STYLE_LIST, null, null, parameterValue, null, null, null);
    }
    public JournalEntry(int itemTyp, int itemId, String user, int action,int parameterId,Long parameterValue) {
        this(itemTyp, itemId, user, action, parameterId, PARAMETER_STYLE_LONG, null, null, null, parameterValue, null, null);
    }
    public JournalEntry(int itemTyp, int itemId, String user, int action,int parameterId,Double parameterValue) {
        this(itemTyp, itemId, user, action, parameterId, PARAMETER_STYLE_DOUBLE, null, null, null,null, parameterValue, null);
    }
    public JournalEntry(int itemTyp, int itemId, String user, int action,int parameterId,Boolean parameterValue) {
        this(itemTyp, itemId, user, action, parameterId, PARAMETER_STYLE_DOUBLE, null, null, null,null, null, parameterValue);
    }

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;

    public Long getId() {
        return id;
    }

    @Persistent
    int itemTyp;
    public int getItemTyp() {
        return itemTyp;
    }
    public void setItemTyp(int itemTyp) {
        this.itemTyp = itemTyp;
    }

    @Persistent
    int itemId;
    public int getItemId() {
        return itemId;
    }
    public void setItemId(int itemId) {
        this.itemId = itemId;
    }

    @Persistent
    String user;
    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    @Persistent
    Date date;
    public Date getDate() {
        return date;
    }
    public void setDate(Date date) {
        this.date = date;
    }

    @Persistent
    int action;
    public int getAction() {
        return action;
    }
    public void setAction(int action) {
        this.action = action;
    }

    @Persistent
    int parameterId;
    public int getParameterId() {
        return parameterId;
    }

    public void setParameterId(int parameterId) {
        this.parameterId = parameterId;
    }

    @Persistent
    int parameterStyle;
    public int getParameterStyle() {
        return parameterStyle;
    }
    public void setParameterStyle(int parameterStyle) {
        this.parameterStyle = parameterStyle;
    }

    @Persistent
    String parameterString;
    public String getParameterString() {
        return parameterString;
    }
    public void setParameterString(String parameterString) {
        this.parameterStyle = PARAMETER_STYLE_STRING;
        this.parameterString = parameterString;
    }
    
    @Persistent
    Date parameterDate;
    public Date getParameterDate() {
        return parameterDate;
    }
    public void setParameterDate(Date parameterDate) {
        this.parameterStyle = PARAMETER_STYLE_DATE;
        this.parameterDate = parameterDate;
    }

    @Persistent
    List<Integer> parameterList;
    public List<Integer> getParameterList() {
        return this.parameterList;
    }
    public void setParameterList(List<Integer> parameterList) {
        this.parameterStyle = PARAMETER_STYLE_LIST;
        this.parameterList = parameterList;
    }
    
    @Persistent
    Long parameterLong;
    public Long getParameterLong() {
        return this.parameterLong;
    }
    public void setParameterLong(Long parameterLong) {
        this.parameterStyle = PARAMETER_STYLE_LONG;
        this.parameterLong = parameterLong;
    }
    
    @Persistent
    Double parameterDouble;
    public Double getParameterDouble() {
        return this.parameterDouble;
    }
    public void setParameterDouble(Double parameterDouble) {
        this.parameterStyle = PARAMETER_STYLE_DOUBLE;
        this.parameterDouble = parameterDouble;
    }

    @Persistent
    Boolean parameterBoolean;
    public Boolean getParameterBoolean() {
        return parameterBoolean;
    }
    public void setParameterBoolean(Boolean parameterBoolean) {
        this.parameterBoolean = parameterBoolean;
    }


}
